package com.v.air.app.ui;

import android.content.Context;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;

import com.v.air.app.AppManager;
import com.v.air.app.BaseActivity;
import com.v.air.app.R;
import com.v.air.app.bean.DeviceBean;

public class AppStart extends BaseActivity {

	@Override
	public int bindLayout() {
		// 设置全屏
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		return R.layout.appstart;
	}

	@Override
	public void initView(View view) {
		DeviceBean.clear(getContext());
		// 添加动画效果
		AlphaAnimation animation = new AlphaAnimation(0.3f, 1.0f);
		animation.setDuration(1000);
		animation.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation animation) {

			}

			@Override
			public void onAnimationRepeat(Animation animation) {

			}

			@Override
			public void onAnimationEnd(Animation animation) {
				MainActivity.startActivity(AppStart.this);
				AppManager.getAppManager().finishActivity();
			}
		});
		view.setAnimation(animation);

	}

	@Override
	public void initData(Context mContext) {

	}

	@Override
	public void initListener() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void destroy() {

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			return false;
		}
		return false;
	}
}
